version 13.1

//Appendix A

 //Table A1
use isq-pta-labor-law-data, replace
order pta_n_net depth_rasch_mean enforce01_mean lcbr_labor l2mean_cbr_region lpwt_gc  lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto
quietly ivpoisson gmm pta_n_net lpwt_gc  lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto ///
 (lcbr_labor =l2.mean_cbr_region), wmatrix(cluster ccode1) multiplicative

su pta_n_net-lgattwto if e(sample)

//figure  a1

use isq-pta-labor-law-data, clear

order pta_n_net depth_rasch_mean enforce01_mean  lcbr_labor l2mean_cbr_region lpwt_gc  lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto

foreach var of varlist pta_n_net-lgattwto{
local i = `i' + 1
hist `var', name(labor_pta`i', replace)percent ylab(, nogrid) kdensity kdenopts(lc(red))  col(gs13)width(0.1) plotregion(lcolor(black)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white) lp(blank) ilp(white)) 
local labor_pta `labor_pta'  labor_pta`i'
} 
graph combine `labor_pta', col(3) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white) lp(blank) ilp(white))

graph export labor_pta_fa1.tif, replace width(8000)

 // figure a2
///colorcor ado found on github is required.  
colorcor pta_n_net-lgattwto

graph export labor_pta_fa2.tif, replace width(8000)


//figure a3 
use isq-pta-labor-law-data, replace
keep if year>1971

bys year: egen cbr_labor_mean_d=mean(cbr_labor)if p_polity2>=8&p_polity2!=.
twoway connected cbr_labor_mean_d year if p_polity2>=8&p_polity2!=., sort ytitle(Labor laws) xtitle(Year) title(Democracies)
graph save fga3a.gph, replace

bys year: egen cbr_labor_mean_nd=mean(cbr_labor_reg)if p_polity2<8&p_polity2!=.
twoway connected cbr_labor_mean_nd year if p_polity2<8&p_polity2!=., sort ytitle(Labor laws) xtitle(Year) title(Non-democracies)
 graph save fga3b.gph, replace

graph combine fga3a.gph fga3b.gph
graph export labor_pta_fa3.tif, replace width(8000)

//figure a4
use isq-pta-labor-law-data, replace

bys year: egen pta_n_net_mean_d=mean(pta_n_net)if p_polity2>=8&p_polity2!=.
twoway connected pta_n_net_mean_d year if p_polity2>=8&p_polity2!=., sort ytitle(Average number of PTAs) xtitle(Year) title(Democracies)
graph save fga4a.gph, replace

bys year: egen pta_n_net_mean_nd=mean(pta_n_net)if p_polity2<8&p_polity2!=.
twoway connected pta_n_net_mean_nd year if p_polity2<8&p_polity2!=., sort ytitle(Average number of PTAs) xtitle(Year) title(Non-democracies)
 graph save fga4b.gph, replace

graph combine fga4a.gph fga4b.gph

graph export labor_pta_fa4.tif, replace width(8000)

//figure a5
use isq-pta-labor-law-data, replace

bys year: egen depth_rasch_mean_d=mean(depth_rasch_mean)if p_polity2>=8&p_polity2!=.

twoway connected depth_rasch_mean_d year if p_polity2>=8&p_polity2!=., sort ytitle(PTA depth) xtitle(Year) title(Democracies)
graph save fga5a.gph, replace

bys year: egen depth_rasch_mean_nd=mean(depth_rasch_mean)if p_polity2<8&p_polity2!=.

twoway connected depth_rasch_mean_nd year if p_polity2<8&p_polity2!=., sort ytitle(PTA depth) xtitle(Year) title(Non-democracies)
graph save fga5b.gph, replace

graph combine fga5a.gph fga5b.gph

graph export labor_pta_fa5.tif, replace width(8000)

//figure a6
use isq-pta-labor-law-data, replace
bys year: egen enforce01_mean_d=mean(enforce01_mean)if p_polity2>=8&p_polity2!=.
twoway connected enforce01_mean_d year if p_polity2>=8&p_polity2!=., sort ytitle(PTA enforccement) xtitle(Year) title(Democracies)
graph save fga6a.gph, replace

bys year: egen enforce01_mean_nd=mean(enforce01_mean)if p_polity2<8&p_polity2!=.
twoway connected enforce01_mean_nd year if p_polity2<8&p_polity2!=., sort ytitle(PTA enforcement) xtitle(Year) title(Non-democracies)
graph save fga6b.gph, replace

graph combine fga6a.gph fga6b.gph
graph export labor_pta_fa6.tif, replace width(8000)


//Table A2 
use isq-pta-labor-law-data, replace

quietly ivpoisson gmm pta_n_net lpwt_gc  lp_polity2 lleft lstatecp lwdi_fdiin lwdi_trade lln_gdppc lwdi_gdpgr lmulti lgattwto ///
 (lcbr_labor =l2.mean_cbr_region), wmatrix(cluster ccode1) multiplicative
keep if e(sample)
sort ccode1
quietly by ccode1: gen dup = cond(_N==1,0,_n)
drop if dup>1
drop dup
sort cname
keep cname
 